package Thread.Test.Test6;

import java.util.ArrayList;

public class jackpot_p {

    //奖池存放数据
    public static ArrayList<Integer> list =new ArrayList<>();

    public static Object lock =new Object();

    public static ArrayList<Integer> list_push1 =new ArrayList<>();

    public static ArrayList<Integer> list_push2 =new ArrayList<>();

    //记录奖项的总钱数
    public static int sum_award_1,sum_award_2;

    //记录奖项的最大钱数
    public static int max_award_1,max_award_2;

    //创建一个用于判断集合中谁最大的方法
    public static int Max_List(ArrayList<Integer> list)
    {
        int max =list.get(0);
        for (int i = 0; i < list.size(); i++) {
            if(max<list.get(i))
            {
                max = list.get(i);
            }
        }
        return max;
    }

    //创建一个打印结果的方法
    public static void Test_print(ArrayList<Integer> list,int i)
    {
        System.out.println("在此次抽奖中,"+i+ "奖池产生了如下奖项.");

        if(i==1)
        {
            System.out.println(list);
            System.out.println("其中,最大值为"+max_award_1+"总钱数为"+sum_award_1);
        }
        if(i==2)
        {
            System.out.println(list);
            System.out.println("其中,最大值为"+max_award_2+"总钱数为"+sum_award_2);
        }
        int sum_n =max_award_1>max_award_2 ? 1:2;
        int sum_s = Math.max(max_award_1, max_award_2);

        System.out.println("在本次奖池中,产生了最大值,在" + sum_n +"奖池中,最大值为" +sum_s);
    }


}
